package api_servers
{
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	import flash.utils.ByteArray;
	
	public class api_utils extends Object {
		public function api_utils() {
			super();
		}
		
		public static function prepareBitmapData(bmp: BitmapData): String {
			var data: String = '';
			if (bmp.width && bmp.height) {
				var ba: ByteArray = bmp.getPixels(new Rectangle(0, 0, bmp.width, bmp.height));
				var i:int = 0;
				while (i < ba.length) {
					if (i % 4 != 0) {
						var code: String = ba[i].toString(16);
						data += (code.length < 2)?('0' + code):code;
					}
					i++;
				}
			}
			return data;
		}		
	}
}